<tc_include file="Public:header" />
<link rel="stylesheet" media="screen" href="./themes/simplebootx/public/css/fileinput.css" />
  <div id="content-container" class="container">
      <if condition="empty($avatar)">
       <div class="alert alert-warning alert-dismissable">
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <strong>您还没有头像</strong>。拥有一个独有的头像，老师和同学们能更容易关注到你哦～～ <a href="{:u('user/center/pic')}"" class="alert-link" target="_blank">点击设置</a>
	  </div>
	  <else/>
	    <if condition="empty($user['user_nicename'])">
	     <div class="alert alert-warning alert-dismissable">
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <strong>您还没设置昵称</strong>。请到个人设置里面设置～～ <a href="{:u('user/center/setting')}" class="alert-link" target="_blank">点击设置</a>
         </div>
        </if>
	 </if>
     <div class="row row-3-9">
        <div class="col-md-3">
           <div class="sidenav">
             <ul class="list-group">
               <li class="list-group-heading"><a href="{:u('Teacher/Center/index')}">我的课程</a></li>
               <li class="list-group-heading">课程管理</li>
               <li class="list-group-item active"><a href="{:u('Teacher/Center/sectionlist',array('cs_id'=>$cs_id))}">课时管理</a></li>
               <li class="list-group-item"><a href="{:u('Teacher/Center/addsection',array('cs_id'=>$cs_id))}">添加课时</a></li>
               <li class="list-group-item"><a href="{:u('Teacher/Center/material',array('cs_id'=>$cs_id))}">资料管理</a></li>
               <li class="list-group-item"><a href="{:u('Teacher/Center/xueyuanlist',array('cs_id'=>$cs_id))}">学员列表</a></li>
               <li class="list-group-item"><a href="{:u('Teacher/Center/pinglun',array('cs_id'=>$cs_id))}">评论列表</a></li>
            </ul>
          </div>
        </div>
        <div class="col-md-9">
         
          <div class="panel panel-default panel-col">
           <div class="panel-heading">课时列表《{$cs_data}》</div>	
	          <form class="js-ajax-form" action="" method="post">
    <div class="table_list">
      <table width="100%" class="table table-hover">
        <thead>
	          <tr>
	            <th width="80">编号</th>
	            <th>课时名称</th>
	            <th width="80">状态</th>
	            <th width="80">是否免费</th>
	            <th width="120">操作</th>
	          </tr>
        </thead>
        	<php>
        		$status=array("1"=>"已审核","0"=>"未审核");
        		$free_status=array("1"=>"免费","0"=>"不免费");
        	</php>
        	<foreach name="sc_data" item="vo">
	        	<tr>
		            <td>{$vo.id}</td>
		            <td>{$vo.sc_name}</td>
		            <td>{$status[$vo['state']]}</td>
		            <td><a onclick="isfree(this,'{$vo['id']}')" href="">{$free_status[$vo['is_free']]}</a></td>
		            <td>
		                <div class="btn-group">
                           <button type="button" class="btn  btn-sm btn-default">管理</button>
                           <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                             <span class="caret"></span>
                             <span class="sr-only"></span>                             
                           </button>                          
                           <ul class="dropdown-menu pull-right" role="menu" >
		               	     <li><a href="{:u('Teacher/Center/secedit',array('id'=>$vo['id']))}">编辑</a></li>
                             <li><a href="{:U('Teacher/Center/materialadd',array('sc_id'=>$vo['id'],'cs_id'=>$cs_id))}"  target="_self">添加资料</a></li>
                             <li><a href="{:U('Teacher/Center/secdelete',array('id' => $vo['id']))}" class="js-ajax-delete" data-subcheck="true" data-msg="你确定删除吗？">删除</a></li>
                           </ul>
                          </div>
					</td>
	          	</tr>
          </foreach>
      
          </table>
          <nav class="text-center"><div class="pagination text-center">{$Page}</div></nav> 
    </div>
  </form>
	        
	      </div>
        </div>
     </div>
   </div>
 
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"  aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-body">
          
         </div>
      </div>
   </div>
</div>
<tc_include file="Public:scripts" /> 
<script src="./themes/simplebootx/public/js/fileinput.js"></script>
<script src="./themes/simplebootx/public/js/fileinput_locale_zh.js"></script>
 <script>
	   
 $("#file-1").fileinput({
     uploadUrl: '{:u('Teacher/Center/cos_upload')}', 
     allowedFileExtensions : ['jpg', 'png','gif','mp4','flv'],
     overwriteInitial: false,
     maxFileSize: 200000,
     maxFilesNum: 1,
     showPreview:false,
     browseClass: "btn btn-default",
     allowedFileTypes: ['image', 'video', 'flash'],
     slugCallback: function(filename) {
         return filename.replace('(', '_').replace(']', '_');
     }
	});
	
$("#file-1").on("fileuploaded", function (data) {
 alert(123);
	
});

 $(document).ready(function() {
     $("#file-1").fileinput({
         'showPreview' : false,
         'allowedFileExtensions' : ['jpg', 'png','gif','mp4','flv'],
         'elErrorContainer': '#errorBlock'
     });
 });
</script>


<script>
function radioSwitch(){
	var val = $('#video input[name="radio"]:checked ').val();
	var yun = document.getElementById('yun');
	var youku = document.getElementById('youku');  
	if(val==1){
		yun.className = 'col-md-7 controls col-md-offset-2';
		youku.className = 'col-md-7 controls col-md-offset-2 hidden';
		document.getElementById("video_type").value='1';
		}else{
			yun.className = 'col-md-7 controls col-md-offset-2  hidden';
			youku.className = 'col-md-7 controls col-md-offset-2';
			document.getElementById("video_type").value='2';
			}
	 
}
</script>  
<script>
 function isfree(obj,id){
	 $.ajax({ url:'{:u('Teacher/Center/isfree')}', 
		 type:"post", data:{'id':id}, 
		 dataType:'json', 
		 success:function(data){
		   location.reload(); 
		   }
		}
	  );
}
 </script>     
<tc_include file="Public:footer" />